package com.gitee.dupe.common.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @author LYH
 */
@Data
@ConfigurationProperties(prefix = DupeProperties.PREFIX)
public class DupeProperties {

    public static final String PREFIX = "dupe";

    /**
     * 验证码
     */
    private CaptchaProperties captcha = new CaptchaProperties();

    /**
     * 用户
     */
    private UserProperties user = new UserProperties();

    /**
     * 文件
     */
    private FileProperties file = new FileProperties();

    /**
     * 日志
     */
    private LogProperties log = new LogProperties();

    @Data

    public static class CaptchaProperties {
        /**
         * 是否启用
         */
        private Boolean enable = true;

        /**
         * 类型
         */
        private CaptchaType type = CaptchaType.NUMBER;

        /**
         * 形状
         */
        private CaptchaShape shape = CaptchaShape.LINE;

    }

    @Data
    public static class UserProperties {
    }


    @Data
    public static class FileProperties {

        /**
         * 文件存放基本路径
         */
        private String basePath = "/data/projects/file";

        private String uriPrefix = "http://127.0.0.1:10000/";

        /**
         * 文件上传存放路径
         */
        public String getUploadPath() {
            return basePath + "/upload";
        }

        /**
         * 临时文件存放路径
         */
        public String getTempPath() {
            return basePath + "/temp";
        }
    }

    @Data
    public static class LogProperties {
        /**
         * 当前日志文件路径
         */
        private String currentLogPath = "/data/projects/logs/spring.log";
    }


}
